function [LaserWL] = sicalibration(datasetname)

% [LaserWL] = sicalibration(datsetname)
%
% This function uses the spectrum of Silicone to return the exact
% wavelength of the exitation Laser to be used for subsequent calibration
% of actual Raman spectra.
%
% INPUT:    datasetname     =   Name of the Si-spectra file
%
% OUTPUT:   LaserWL         =   Wavelength of exitation Laser 

if nargin<1,
    help sicalibration
    return
end

%% -----==================== CONFIG ====================-----
% ----- Set the reference peak (Si = 520 cm-1) -----
ramanpeak = 520;         % put here in cm-1



%% -----==================== CODE ====================-----
ramanpeak = ramanpeak/10000000;

try load(datasetname)
catch ME
  errordlg('ERROR: file not found in "sicalibration"!')
  return
end
load(datasetname)

% ----- pick Si-peak -----
scrsz = get(0,'ScreenSize');
Sichooser = figure('OuterPosition',...
                [scrsz(4)*0.25 40 scrsz(3)*0.9 scrsz(4)*0.5]);
    sigraph = axes();    plot(datax,datay);     h = zoom;
%    setAxesZoomMotion(h,sigraph,'horizontal');
    zoom
    uiwait(msgbox({'Zoom in on the silicone peak, please...' '' '' ...
                'Press OK when the peak maximum is easy to click.'},...
                'Zoom in on Peak'))
    setAllowAxesZoom(h,sigraph,false);
    q = msgbox('Click on the silicone peak, please...',...
                'Choose Peak');
    axes(sigraph)
    [x ~] = ginput(1);
    close(q), close(Sichooser)

% ----- Compute LaserWL -----    
LaserWL = (1/(ramanpeak+(1/x)));